/*
 *****************************************************************************
 * Copyright (C) 2005-2011 UC Mobile Limited. All Rights Reserved
 * File			: AutomatedMenuDataProcessor.m
 *
 * Description	: 常用自动化测试设置事件驱动者
 *
 * Author		: daijb@ucweb.com
 * History		:
 *			   Creation, 2014/03/14, daijb, Create the file
 ******************************************************************************
 **/
#if defined(UC_COMMON_AUTOMATED_TEST) || defined(UC_MONKEY_TEST)
#import "VerDefine.h"

#import "AutomatedSettingDataProcessor.h"

@implementation AutomatedSettingDataProcessor

//清除网页缓存
- (void)onClickClearWebPageCacheSetting:(NSString*)itemName
{
    [g_automatedFuncInstance clearWebPageCache];
    [self dismissWithAnimation:YES completion:nil];
}

//广告过滤开关
- (void)onClickAdBlockSetting:(NSString*)itemName
{
    [g_automatedFuncInstance adBlockSetting];
    [self dismissWithAnimation:YES completion:nil];
}

//云加速开关
- (void)onClickCloudSpeedUpSetting:(NSString*)itemName
{
    [g_automatedFuncInstance cloudSpeedUp];
    [self dismissWithAnimation:YES completion:nil];
}

//精简排版开关
- (void)onClickViewModeFillScreenSetting:(NSString*)itemName
{
    [g_automatedFuncInstance viewModeFillScreen];
    [self dismissWithAnimation:YES completion:nil];
}

//网页预加载开关
- (void)onClickReloadWebPageSetting:(NSString*)itemName
{
    [g_automatedFuncInstance reloadWebPage];
    [self dismissWithAnimation:YES completion:nil];
}

//清除所有数据
- (void)onClickClearAllDataSetting:(NSString*)itemName
{
    [g_automatedFuncInstance clearAllData];
    [self dismissWithAnimation:YES completion:nil];
}

//清除本地下载任务
- (void)onClickClearLocalDownloadTaskSetting:(NSString*)itemName
{
    [g_automatedFuncInstance clearLocalDownloadTask];
    [self dismissWithAnimation:YES completion:nil];
}

//恢复默认设置
- (void)onClickRestoreDefaultSettingSetting:(NSString*)itemName
{
    [g_automatedFuncInstance restoreDefaultSetting];
    [self dismissWithAnimation:YES completion:nil];
}

- (void)onClickSwitchUASetting:(NSString*)itemName
{
    [g_automatedFuncInstance switchUA];
    [self dismissWithAnimation:YES completion:nil];
}

- (void)dismissWithAnimation:(BOOL)animation completion:(void(^)(void))completion
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(dismissWithAnimatin:completion:)])
    {
        [self.delegate dismissWithAnimatin:YES completion:completion];
    }
}

@end
#endif
